$(function(){
	
})

function getNow(s) {
	return s < 10 ? '0' + s : s;
}

function getDate() {
	var myDate = new Date();

	var year = myDate.getFullYear(); //获取当前年
	var month = myDate.getMonth() + 1; //获取当前月
	var date = myDate.getDate(); //获取当前日

	var h = myDate.getHours(); //获取当前小时数(0-23)
	var m = myDate.getMinutes(); //获取当前分钟数(0-59)
	var s = myDate.getSeconds();
	return year + '-' + getNow(month) + "-" + getNow(date);
}

 function getDay(day){
 　　var today = new Date();
 　　var targetday_milliseconds=today.getTime() + 1000*60*60*24*day;
 　　today.setTime(targetday_milliseconds); //注意，这行是关键代码
 　　var tYear = today.getFullYear();
 　　var tMonth = today.getMonth();
 　　var tDate = today.getDate();
 　　tMonth = doHandleMonth(tMonth + 1);
 　　tDate = doHandleMonth(tDate);
 　　return tYear+"-"+tMonth+"-"+tDate;
 }
 
 function doHandleMonth(month){
  　　var m = month;
  　　if(month.toString().length == 1){
  　　　　m = "0" + month;
  　　}
  　　return m;
  }

function setHeader(xhr) {
	if (!window.localStorage.token) {
		window.location.href = "index.html";
	} else {
		xhr.setRequestHeader("Authorization", window.localStorage.token);
	}
}
